const UserController = require('./controller/program/User');
const UserInfoController = require('./controller/program/UserInfo');
const AdminController = require('./controller/admin/User');
const MerchantsController = require('./controller/admin/Merchants');
const CustomerController = require('./controller/admin/Customer');
const MembersController = require('./controller/admin/Members');
const SynchronizeController = require('./controller/admin/Synchronize');
const TimeCardController = require('./controller/admin/TimeCard');
const DrivesController = require('./controller/admin/Drives');
const SettingController = require('./controller/admin/Setting');
const InstructionsController = require('./controller/admin/Instructions');
const QuestionController = require('./controller/admin/Question');
const DashboardController = require('./controller/admin/Dashboard');
const GivingController = require('./controller/admin/Giving');
const GivingUserController = require('./controller/program/Giving');
const CardController = require('./controller/program/Card');
const PayController = require('./controller/program/Pay');
const SweepController = require('./controller/program/Sweep');
const ShareController = require('./controller/program/Share');
const MapController = require('./controller/program/Map');
const DriversReportController = require('./controller/admin/DriversReport');
const CountdownController = require('./controller/program/Countdown');
const SettlementController = require('./controller/admin/Settlement');
const CheckController = require('./controller/admin/Check');
module.exports = router => {
    router.prefix('/api');
    router
        // admin
        // ① 后台登录
        .post('/admin/login', AdminController.login)
        .get('/admin/info', AdminController.Info)
        .get('/admin/logout', AdminController.logout)
        .put('/admin/changePassword', AdminController.changePassword)
        // ② 商户
        .get('/admin/merchants', MerchantsController.index)
        .get('/admin/merchants/select', MerchantsController.select)
        .get('/admin/merchants/detail', MerchantsController.detail)
        .del('/admin/merchants/:id', MerchantsController.deletes)
        .post('/admin/merchants', MerchantsController.create)
        .put('/admin/merchants/:id', MerchantsController.editor)
        // ③ 用户
        .get('/admin/customer', CustomerController.index)
        .put('/admin/customer/:id', CustomerController.edit)
        .del('/admin/customer/:id', CustomerController.deletes)
        .get('/admin/customer/detail', CustomerController.detail)
        .post('/admin/customer/change', CustomerController.change)
        // ④ 卡片
        .get('/admin/members', MembersController.index)
        .put('/admin/members/:id', MembersController.edit)
        .del('/admin/members/:id', MembersController.deletes)
        .post('/admin/members', MembersController.create)
        // ⑤ 同步设备
        .get('/admin/synchronize/drives', SynchronizeController.drives)
        // ⑥ 次卡
        .get('/admin/timeCard', TimeCardController.index)
        .post('/admin/timeCard', TimeCardController.create)
        .put('/admin/timeCard/:id', TimeCardController.edit)
        .del('/admin/timeCard/:id', TimeCardController.deletes)
        // ⑦ 设备
        .get('/admin/drives', DrivesController.index)
        .put('/admin/drives/:id', DrivesController.edit)
        .del('/admin/drives/:id', DrivesController.deletes)
        .post('/admin/drives/:id', DrivesController.unbinding)
        .put('/admin/drives/address/:id', DrivesController.address)
        .get('/admin/drives/detail', DrivesController.detail)
        // ⑧ 设置
        .get('/admin/setting', SettingController.index)
        .put('/admin/setting/:id', SettingController.edit)
        // ⑨ roles
        .get('/admin/instructions', InstructionsController.index)
        .put('/admin/instructions/:id', InstructionsController.edit)
        // ⑩ 问题
        .get('/admin/question', QuestionController.index)
        .put('/admin/question/:id', QuestionController.edit)
        .post('/admin/question', QuestionController.create)
        .del('/admin/question/:id', QuestionController.deletes)
        // ⑪ 首页
        .get('/admin/dashboard', DashboardController.index)
        .get('/admin/dashboardInfo', DashboardController.info)
        .get('/admin/cardInfo', DashboardController.cardInfo)
        .get('/admin/washInfo', DashboardController.washInfo)
        .get('/admin/deviceInfo', DashboardController.deviceInfo)
        // ⑫ 邀请
        .get('/admin/giving', GivingController.index)
        .post('/admin/giving', GivingController.create)
        .get('/admin/giving/member', GivingController.member)
        .del('/admin/giving/:id', GivingController.deletes)
        // ⑬ 结算
        .get('/settlement', SettlementController.index)
        .get('/SettlementCar', SettlementController.SettlementCar)
        .get('/Check', CheckController.index)
        // program
        // ① 用户相关、获取openID
        .post('/user/login', UserController.login)
        .get('/user/info', UserInfoController.info)
        .get('/user/use', UserInfoController.use)
        .get('/user/question', UserInfoController.question)
        .post('/user/phone', UserInfoController.phone)
        // ② 奖励
        .get('/giving/giving', GivingUserController.giving)
        .get('/giving/share', GivingUserController.share)
        // ③ 卡片
        .get('/card/members', CardController.members)
        .get('/card/timeCard', CardController.timeCard)
        // ④ 支付
        .post('/pay/sign', PayController.sign)
        .post('/pay/notify', PayController.notify)
        // ⑤ 开启洗车
        .post('/sweep', SweepController.index)
        // ⑥ 次卡
        .post('/share', ShareController.share)
        // ⑦ 地图
        .get('/map', MapController.index)
        // ⑧ 设备通知
        .get('/ReportStatus', DriversReportController.ReportStatus)
        .get('/BeginService', DriversReportController.BeginService)
        .get('/FinishService', DriversReportController.FinishService)
        // ⑨ 倒计时
        .post('/countdown', CountdownController.countdown);
};
